package com.zbl.zblproject.contract.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.contract.entity.Contract;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2019/3/14
 */
@Repository
public interface ContractMapper extends BaseMapper<Contract> {

    @Select("SELECT * FROM zbl_contract WHERE suppliers_id = #{supplierId} AND  NOW() >= start_time AND NOW() <= end_time  LIMIT 1 ")
    Contract getContractSinceTimeBySupplierId(Integer supplierId);

    @Select("select cash_back from zbl_contract where suppliers_id = #{suppliersId}")
    List<Double> getSupIdCashBack(@Param("suppliersId")int suppliersId);
}
